<?php
namespace Demo\Director;

/**
 * 生成器模式
 * 生成器的目的是将复杂对象的创建过程（流程）进行抽象，生成器表现为接口的形式
 */
class Director
{
    public function build(Builder $builder,string $message): Vehicle
    {
        $builder->createVehicle();
        $builder->addDoors();
        $builder->addEngine();
        $builder->addWheel();
        echo  $message.PHP_EOL;
        return $builder->getVehicle();
    }
}